package com.jz.netthings.application.stockManage.controller;


import com.jz.netthings.application.stockManage.bean.ConsumablesSupplier;
import com.jz.netthings.application.stockManage.service.ConsumablesSupplierService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 耗材供应商 前端控制器
 * </p>
 *
 * @author yangyunyun
 * @since 2019-07-19
 */
@RestController
@RequestMapping("/adscm/application/consumablesSupplier")
public class ConsumablesSupplierController {

    @Autowired
    ConsumablesSupplierService consumablesSupplierService;

    /**
     * 新增供应商信息
     * @param consumablesSupplier
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/insertSupplier")
    public SimpleCoreResponse insertSupplier(@RequestBody ConsumablesSupplier consumablesSupplier) throws AdscmSystemException {

        consumablesSupplierService.insert(consumablesSupplier);
        return new SimpleCoreResponse("200","新增成功",null);
    }
    /**
     * 查询所有供应商信息
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/selectAll")
    public SimpleCoreResponse selectAll() throws AdscmSystemException {

        return new SimpleCoreResponse("200","查询成功",consumablesSupplierService.selectList(null));
    }

}

